package com.atguigu.es.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * @author Jia Fa
 * @create 2021-12-05 21:03
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document(indexName = "user", shards = 3,replicas = 2)
public class User {
    @Id
    private Long id;
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String name;
    @Field(type = FieldType.Integer)
    private Integer age;
    @Field(type = FieldType.Keyword,index = false)
    private String password;
}

/*@Document(indexName = 索引库名称,shards = 3分片数量,replicas = 2副本数量);
@Id 主键
@Field(type = FieldType枚举类表示字段的类型,analyzer = 分词器,index = 是否索引,store = 是否存储)*/
